﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

using QuDao;
using FineUICore;
using Kalman;
using Kalman.Extensions;
using Kalman.Security;

namespace AdminUI.Pages.SysManage
{
    public partial class ResetPwdModel : BaseModel
    {
        public void OnGet(int id)
        {
            Current = SysUserBO.Instance.GetItem<SysUser>(id);
        }

        public SysUser Current { get; set; }

        public IActionResult OnPostBtnSubmit_Click(int userID, string newPwd)
        {
            var newPwdMD5 = HashCryto.GetHash2String(newPwd, HashAlgorithmType.MD5);
            SysUserBO.Instance.ResetPwd(userID, newPwdMD5);
            //LogAction(ActionType.修改, $"ÖØÖÃÃÜÂë£º{userID}");

            //FineUICore.PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
            ActiveWindow.Hide();
            return UIHelper.Result();
        }
    }
}
